<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>解构赋值的实现</title>
</head>
<body>
<script>

    let a = 1
     let b = 2
     let c = 3
    console.log(a,b,c)

    //使用解构之后
    let [x ,y , z] = [1,2,3,3]
    console.log(x,y,z)

    //对象解构
    let user = {name:'hello',age:18}
    //传统
    // let name = user.name
    // let age = user.age

    //es6
    let {name, age} = user
    console.log(name,age)


    //定义方法简写
    //1.传统
    const person1 = {sayHi:function () {
            console.log('hi i am College student from nnxy')
        }}
        person1.sayHi()

    //es6
    const person2 = {sayHi(){
            console.log('sayHi i am college student')
        }}
        person2.sayHi();


    //对象拓展运算符
    let people = {name:'jack',age:19}
    let human = {...people}
    console.log(human)

    let input = [1,3,4]
    input = input.map(value => value+1)
    console.log(input)


</script>
</body>
</html>